import java.util.Arrays;

public class ch05_1_2 {

    public static void main(String[] args) {
        //排序
        int[] a = {1,5,2,9,3};
        System.out.println("排序前：" + Arrays.toString(a));
        sort(a);
        System.out.println("排序后：" + Arrays.toString(a));
    }

    public static void sort(int[] a) {
        for (int i = 0; i < a.length ; i++) {
            for (int j = 0; j < a.length - 1 - i; j++) {
                if(a[j] > a[j + 1]){
                    int tem = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = tem;
                }
            }
        }
    }
}
